package com.mysmartphone.adapter;

import java.util.ArrayList;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.mysmartphone.vistas.R;

public class SpinnerListAdapter extends BaseAdapter{

	private Context context;
	private ArrayList<String> listBrands;
	private Toast toast;
	private long time_start =0;
	private long time_end =0;

	public SpinnerListAdapter(Context context, ArrayList<String> listBrands) {
		this.context = context;
		this.listBrands = listBrands;
		
	}

	@Override
	public int getCount() {
		return listBrands.size();
	}

	@Override
	public Object getItem(int position) {
		return listBrands.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(final int position, View convertView, ViewGroup parent) {

		if (convertView == null) {
			LayoutInflater mInflater = (LayoutInflater) context
					.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
			convertView = mInflater.inflate(R.layout.spinner_list_row, null);

		}
		ImageView logo = (ImageView) convertView.findViewById(R.id.logo);
		logo.setImageResource(R.drawable.cubot);
		TextView txtBrand = (TextView) convertView.findViewById(R.id.brand);
		txtBrand.setText(listBrands.get(position));
		return convertView;
	}
}
